package br.com.insight.consultoria.negocio.bo;

import java.util.List;

import br.com.insight.consultoria.entity.CursoExtraCurricular;
import br.com.insight.consultoria.entity.Usuario;
import br.com.insight.consultoria.erro.exception.InsightConstants;
import br.com.insight.consultoria.erro.exception.InsightException;
import br.com.insight.consultoria.erro.exception.SistemaException;
import br.com.insight.consultoria.integracao.dao.interfacedao.CursoExtraCurricularDAO;
import br.com.insight.consultoria.negocio.bo.interfacebo.CursoExtraCurricularBO;

public class CursoExtraCurricularImpBO implements CursoExtraCurricularBO{

	private CursoExtraCurricularDAO cursoExtraCurricularDAO;
	
	@Override
	public void inserir(CursoExtraCurricular cursoExtraCurricular)
			throws InsightException {

		try{
			
			getCursoExtraCurricularDAO().inserir(cursoExtraCurricular);
			
		}catch(InsightException exception){
			
			throw exception;
			
		}catch(Exception exception){
			
			throw new SistemaException(InsightConstants.MENSAGEM_ERRO_NAO_TRATADO,exception);
			
		}
		
	}
	
	@Override
	public void alterar(CursoExtraCurricular cursoExtraCurricular)
			throws InsightException {

		try{
			
			getCursoExtraCurricularDAO().alterar(cursoExtraCurricular);
			
		}catch(InsightException exception){
			
			throw exception;
			
		}catch(Exception exception){
			
			throw new SistemaException(InsightConstants.MENSAGEM_ERRO_NAO_TRATADO,exception);
			
		}
		
	}
	
	@Override
	public void excluir(CursoExtraCurricular cursoExtraCurricular)
			throws InsightException {
		
		try{
			
			getCursoExtraCurricularDAO().excluir(cursoExtraCurricular);
			
		}catch(InsightException exception){
			
			throw exception;
			
		}catch(Exception exception){
			
			throw new SistemaException(InsightConstants.MENSAGEM_ERRO_NAO_TRATADO,exception);
			
		}
		
	}
	
	@Override
	public CursoExtraCurricular getCursoExtraCurricular(Long id)
			throws InsightException {
		
		CursoExtraCurricular cursoExtraCurricular=null;
		
		try{
			
			cursoExtraCurricular=getCursoExtraCurricularDAO().getCursoExtraCurricular(id);
			
		}catch(InsightException exception){
			
			throw exception;
			
		}catch(Exception exception){
			
			throw new SistemaException(InsightConstants.MENSAGEM_ERRO_NAO_TRATADO,exception);
			
		}
		
		return cursoExtraCurricular;
	}
	
	@Override
	public List<CursoExtraCurricular> pesquisar(Usuario usuario)
			throws InsightException {
		
		List<CursoExtraCurricular> cursoExtraCurricular=null;
		
		try{
			
			cursoExtraCurricular=getCursoExtraCurricularDAO().pesquisar(usuario);
			
		}catch(InsightException exception){
			
			throw exception;
			
		}catch(Exception exception){
			
			throw new SistemaException(InsightConstants.MENSAGEM_ERRO_NAO_TRATADO,exception);
			
		}
		
		return cursoExtraCurricular;
	}

	public CursoExtraCurricularDAO getCursoExtraCurricularDAO() {
		return cursoExtraCurricularDAO;
	}

	public void setCursoExtraCurricularDAO(
			CursoExtraCurricularDAO cursoExtraCurricularDAO) {
		this.cursoExtraCurricularDAO = cursoExtraCurricularDAO;
	}
	
	
}
